import request from '@/utils/request'

// 通过扫码获取物料列表信息推送到缓存，并判断是否重复
export function push(data) {
  return request({
    url: '/hs/scan/push',
    method: 'post',
    data: data,
  })
}

// 创建新托盘
export function create(code) {
  return request({
    url: '/hs/scan/create?code=' + code,
    method: 'post',
  })
}

// 创建新托盘
export function merge(data) {
  return request({
    url: '/hs/scan/merge',
    method: 'post',
    data: data,
  })
}

// 通过RFID编码获取待拣取的物料明细列表
export function getToBePickedMaterialList(params) {
  return request({
    url: '/hs/scan/get-tobepicked-material-list',
    method: 'get',
    params
  })
}

// 通过RFID编码获取待拣取的物料箱列表
export function getToBePickedMaterialBoxList(params) {
  return request({
    url: '/hs/scan/get-tobepicked-materialbox-list',
    method: 'get',
    params
  })
}

// 给指定标签发送闪灯指令
export function lightFlash(rfidCode, light) {
  return request({
    url: '/hs/scan/light-flash?rfidCode=' + rfidCode + "&light=" + light,
    method: 'get',
  })
}

export function getTrayRfidInfo(code) {
  return request({
    url: '/hs/scan/tray-or-rfid?code=' + code,
    method: 'get',
  })
}

// 通过托盘、RFID编码获取托盘上的物料和物料箱列表
export function getMaterialOrBox(pickTaskId, code) {
  return request({
    url: '/hs/scan/material-or-box?pickTaskId=' + pickTaskId + '&code=' + code,
    method: 'get',
  })
}

export function getMaterialBoxByCode(code) {
  return request({
    url: '/hs/scan/material-box-code?code=' + code,
    method: 'get',
  })
}

// 手动调整
export function manualAdjust(data) {
  return request({
    url: '/hs/scan/manual-adjust',
    method: 'post',
    data: data,
  })
}

// 获取已经拾取物料、物料箱信息
export function getPickedList(pickTaskId) {
  return request({
    url: '/hs/scan/get-picked-list?pickTaskId=' + pickTaskId,
    method: 'get',
  })
}

